import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VueRouter from 'vue-router';
import Welcome from './views/Welcome.vue';
import PhotoAlbum from './views/PhotoAlbum2.vue';
import Photos from './views/Photos1.vue';
import LoginPage from './views/LoginPage.vue';
import Admin from './views/Admin.vue';
import { stopp } from "@/js/flower"; // 导入停止特效的方法

Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.use(VueRouter);

const routes = [
  { path: '/', component: Welcome },
  { path: '/photoAlbum', component: PhotoAlbum },
  { path: '/photos', component: Photos },
  { path: '/login', component: LoginPage },
  { path: '/admin', component: Admin }
];

const router = new VueRouter({
  routes
});

router.beforeEach((to, from, next) => {
  // 如果不是主页，则停止特效
  if (to.name !== 'Welcome') {
    stopp();
  }
  next(); // 继续路由导航
});

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
